//
//  Brandsbr2ViewController.m
//  UI_A段项目_iDaily Watch
//
//  Created by lianglide on 14-10-15.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "Brandsbr2ViewController.h"
#import "NewsFifthTableViewCell.h"
#import "NewsForthTableViewCell.h"
#import "UIButton+WebCache.h"
#import "NewsModel.h"
#import "NewsSixthTableViewCell.h"
@interface Brandsbr2ViewController ()

@end

@implementation Brandsbr2ViewController


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        _array4 = [[NSMutableArray alloc]init];
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    
    _table5 = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, 320, 480) style:UITableViewStylePlain];
    _table5.delegate = self;
    _table5.dataSource = self;
    [self.view addSubview:_table5];
   
    
//    NSLog(@"%@",_arr1);
//    NSLog(@"%@",_number);
    NSLog(@"%@",_array4);
    _str = [_array4[[_number intValue] - 100]pubdate1] ;
    _str1 = [_array4[[_number intValue] - 100]title];
    _str2 = [_array4[[_number intValue] - 100]summary];
    _str3 = [_array4[[_number intValue] - 100]content];
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    return 2;
    
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        NewsSixthTableViewCell *cell = [[NewsSixthTableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
        cell.backgroundColor = [UIColor lightGrayColor];
        [cell.dbutton1 setBackgroundImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",_arr1[[_number intValue]- 100]]] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"2.png"]];
        cell.dbutton1.layer.transform = CATransform3DMakeRotation(1, 0, 0,0 );
        cell.selectionStyle = NO;
        [cell.dlable1 setText:[NSString stringWithFormat:@"品牌:%@",_str1]];
        [cell.dlable2 setText:[NSString stringWithFormat:@"发行时间:%@",_str]];
        [cell.dlable3 setText:[NSString stringWithFormat:@"%@",_str2]];
        [cell.dlable3 setFont:[UIFont systemFontOfSize:12]];
        [cell.dlable1 setFont:[UIFont systemFontOfSize:13]];
        [cell.dlable2 setFont:[UIFont systemFontOfSize:9]];

                           return cell;
        }
    else if(indexPath.row == 1){
    
    
        UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
        UILabel *elable1 = [[UILabel alloc]initWithFrame:CGRectMake(2, 200, 316, 50)];
        elable1.backgroundColor = [UIColor blackColor];
        elable1.alpha = 0.6;
        [cell addSubview:elable1];
       
        _webView1 = [[UIWebView alloc]initWithFrame:CGRectMake(0, 175, 320, 600)];
        
        _webView1.scalesPageToFit = YES;
        _webView1.scrollView.scrollEnabled = NO;
        [self.table5 addSubview:_webView1];//<font size=30><font/>
        NSString *str1 = @"<font size=12>";
         NSString *str2 = _str3;
        NSString *str4 = @"<font/>";
        NSString  *str = [NSString stringWithFormat:@"%@%@%@",str1,str2,str4];
        
        _webView1.backgroundColor = [UIColor whiteColor];
        
        [_webView1 loadHTMLString:str baseURL:nil];
        UILabel *lablex = [[UILabel alloc]initWithFrame:CGRectMake(0, 420,320 ,30)];
        lablex.layer.cornerRadius = 10;
        lablex.layer.masksToBounds = YES;
        lablex.backgroundColor = [UIColor blackColor];
        lablex.alpha = 0.8;
        [self.view addSubview:lablex];
        UIButton *buttonx1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        buttonx1.frame = CGRectMake(0, 0, 40, 30);
        [buttonx1 setTitle:@"返回" forState:UIControlStateNormal];
        buttonx1.backgroundColor = [UIColor blackColor];
        [buttonx1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [lablex addSubview:buttonx1];//TodayShare
        UIButton *buttonx2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        buttonx2.frame = CGRectMake(140, 0, 40, 30);
        [buttonx2 setBackgroundImage:[UIImage imageNamed:@"TodayShare.png"] forState:UIControlStateNormal];
        [buttonx2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [lablex addSubview:buttonx2];//TodayShare
        
        UIButton *buttonx3 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        buttonx3.frame = CGRectMake(270, 0, 40, 30);
        [buttonx3 setBackgroundImage:[UIImage imageNamed:@"Today列表.png"] forState:UIControlStateNormal];
        [buttonx3 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [lablex addSubview:buttonx3];//TodayShare
        

        
        return cell;
    
    }
    return 0;

}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{

    if (indexPath.row == 0) {
        return 170;
    }
    return 600;

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    [tableView deselectRowAtIndexPath:indexPath animated:NO];

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
